<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/jsppages/include/taglibs.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title><%=system_name%> - 船方自购物料</title>
	<base href="<%=basePath%>" />	
 	<meta http-equiv="pragma" content="no-cache" />
 	<meta http-equiv="cache-control" content="no-cache" />
	<meta http-equiv="expires" content="0" />
	<link type="image/x-icon" rel="shortcut icon" href="<%=basePath%>images/favicon.ico" />
	<link href="<%=basePath%>css/common.css" rel="stylesheet" type="text/css" />
	<link href="<%=basePath%>css/userlist.css" rel="stylesheet" type="text/css" />
	<script src="<%=basePath%>js/common.js" type="text/javascript"></script>
	<script type="text/javascript" src="js/pagebar_cn.js"></script>
	<script type="text/javascript" src="fram/engine.js" ></script>
	<script type="text/javascript" src="fram/util.js" ></script>
	<script type="text/javascript" src="fram/interface/shipService.js"></script>
	<script type="text/javascript" src="<%=basePath%>js/DatePicker/WdatePicker.js" defer="defer"></script>
	
	<script type="text/javascript">
	function beforeSubmit(){
		var materialId=$("material_id").value;
		var format=$("format").value;
		if(""==materialId){alert("请选择物料清单");return false;}
		if(""==format){alert("请填写规格型号");return false;}
		if(format.length>100){alert("货号不能操作100个字");return false;}
		if($N("unit")[0].value.length>50){alert("计量单位不能操作50个字");return false;}
		if($N("details")[0].value.length>300){alert("船方自购物料不能操作300个字");return false;}
		if($N("remark")[0].value.length>300){alert("备注不能操作300个字");return false;}
		
		window.parent.submitStock();
		return true;
	}
	
	function browse(){
		openWindow("<%=basePath%>trade/showMaterialList?"+Math.random());
	}
	function openWindow(url){        
		if (navigator.appVersion.indexOf("MSIE") == -1){
			window.open(url,'newWin','modal=yes,width=510,height=440,top=200,left=300,resizable=no,depended=yes,scrollbars=no');
	        return;
	    }else{
	    	if(navigator.appVersion.match(/MSIE ([\d.]+)/)[1]=='6.0'){
	    		showModalDialog(url,window,'dialogWidth:530px;dialogHeight:490px;')
	    	}else{
	        	showModalDialog(url,window,'dialogWidth:510px;dialogHeight:440px;')
	        }
	    }
	}
	function browsBack(id,name){
		$("materialName").value=name;
		$("material_id").value=id;
	}
	
	</script>
	
</head>

<body>
<form:form method="post" name="myform" onsubmit="return beforeSubmit();">
<table class="tabView" style="width:500px;margin-top:2px;">
	<tr>
		<th style="width:80px;">开始时间：</th>
		<td style="width:170px">
		<input type="text" name="startDate" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" value="<fmt:formatDate value="${command.startDate}" pattern="yyyy-MM-dd"/>"/>
		</td>
		<th width="80">物料清单：</th><td width="170"><input type="text" id="materialName"  value="${command.material.name}" style="width:100px" disabled="disabled"/><input type="text" name="material.id" id="material_id"  value="${command.material.id}" style="display:none"/><input type="button" onclick="browse()" value="选择" style="width:40px;"/></td>
	</tr>
	<tr>
		<th>规格型号：</th><td><input type="text" name="format" id="format" value="${command.format}"/></td><th>主计量单位：</th><td><input type="text" name="unit" value="${command.unit}" /></td>
	</tr>
	<tr>
		<th>数量：</th><td><input type="text" name="amount" value="${command.amount}" onkeyup="value=value.replace(/[^0-9]/g,'')"/></td><th>状态：</th><td><input type="radio" name="status" checked="checked"/>启用 <input type="radio" name="status"/>禁用</td>
	</tr>
	<tr>
		<th>船方自购物料：</th><td colspan="3"><textarea id="details" name="details" rows="2" cols="40">${command.details}</textarea></td>
	</tr>
	<tr>
		<th>备注：</th><td colspan="3"><textarea id="remark" name="remark" rows="2" cols="40">${command.remark}</textarea></td>
	</tr>
	<tr>
		<input type="hidden" id="user.id" name="user.id" value="${sessionScope.memberSessionInfo.userId}" />
		<!-- <input type="hidden" id="shipInfo.id" name="shipInfo.id" value="${command.shipInfo.id}" /> -->
		<td colspan="4" style="text-align:center"><input type="submit" value=" 提 交 " class="btn1"/></td></tr>
</table>
</form:form>
</body>
</html>
